﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" CornerRadius="1" BorderThickness="1"
                  BorderBrush="{DynamicResource ScrollOutterBorderBrush}" Background="{DynamicResource ScrollOutterBackgroundBrush}">
            <Border x:Name="border" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="1"
                    BorderThickness="1" BorderBrush="{DynamicResource ScrollInnerBorderBrush}"
                    Background="{DynamicResource ScrollInnerBackgroundBrush}">
              <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                    Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" />
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="Panel.Background" Value="White">
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="Background" TargetName="border" Value="{DynamicResource TransparentBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border"
                      Value="{DynamicResource ScrollOverOutterBorderBrush}" />
              <Setter Property="Background" TargetName="Border"
                      Value="{DynamicResource ScrollOverOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ScrollOverInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollOverInnerBackgroundBrush}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border"
                      Value="{DynamicResource ScrollPressedOutterBorderBrush}" />
              <Setter Property="Background" TargetName="Border"
                      Value="{DynamicResource ScrollPressedOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollPressedInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollPressedInnerBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="Background" TargetName="border" Value="{DynamicResource TransparentBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF747576" Offset="0" />
          <GradientStop Color="#FF454647" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" CornerRadius="1" BorderThickness="1"
                  Background="{DynamicResource ScrollOutterBackgroundBrush}" BorderBrush="{DynamicResource ScrollOutterBorderBrush}">
            <Border x:Name="border1" Width="Auto" BorderBrush="{DynamicResource ScrollInnerBorderBrush}"
                    BorderThickness="1" CornerRadius="1" Background="{DynamicResource ScrollInnerBackgroundBrush}" Padding="2"
                    ClipToBounds="True">
              <StackPanel Width="Auto" Orientation="Horizontal" VerticalAlignment="Center"
                          HorizontalAlignment="Center" Height="8" Visibility="Visible">
                <Rectangle Stroke="#66000000" Width="1" Margin="0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66F8F8F8" Width="1" Margin="0,2,0,0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66000000" Width="1" Margin="0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66F8F8F8" Width="1" Margin="0,2,0,0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66000000" Width="1" Margin="0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66F8F8F8" Width="1" Margin="0,2,0,0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66000000" Width="1" Margin="0" Height="Auto" HorizontalAlignment="Left" />
                <Rectangle Stroke="#66F8F8F8" Width="1" Margin="0,2,0,0" Height="Auto" HorizontalAlignment="Left" />
              </StackPanel>
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollPressedOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollPressedOutterBorderBrush}" />
              <Setter Property="BorderBrush" TargetName="border1"
                      Value="{DynamicResource ScrollPressedInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border1"
                      Value="{DynamicResource ScrollPressedInnerBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollOverOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollOverOutterBorderBrush}" />
              <Setter Property="BorderBrush" TargetName="border1"
                      Value="{DynamicResource ScrollOverInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border1"
                      Value="{DynamicResource ScrollOverInnerBackgroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="VerticalScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" CornerRadius="1" BorderThickness="1"
                  BorderBrush="{DynamicResource ScrollVerticalOutterBorderBrush}"
                  Background="{DynamicResource ScrollVerticalOutterBackgroundBrush}">
            <Border x:Name="border" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="1"
                    BorderThickness="1" BorderBrush="{DynamicResource ScrollVerticalInnerBorderBrush}"
                    Background="{DynamicResource ScrollVerticalInnerBackgroundBrush}">
              <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
                    Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" />
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="Panel.Background" Value="White">
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="Background" TargetName="border" Value="{DynamicResource TransparentBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border"
                      Value="{DynamicResource ScrollVerticalOverOutterBorderBrush}" />
              <Setter Property="Background" TargetName="Border"
                      Value="{DynamicResource ScrollVerticalOverOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollVerticalOverInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollVerticalOverInnerBackgroundBrush}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border"
                      Value="{DynamicResource ScrollVerticalPressedOutterBorderBrush}" />
              <Setter Property="Background" TargetName="Border"
                      Value="{DynamicResource ScrollVerticalPressedOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollVerticalPressedInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollVerticalPressedInnerBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource TransparentBrush}" />
              <Setter Property="Background" TargetName="border" Value="{DynamicResource TransparentBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="Foreground">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FF747576" Offset="0" />
          <GradientStop Color="#FF454647" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="VerticalScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" CornerRadius="1" BorderThickness="1"
                  Background="{DynamicResource ScrollVerticalOutterBackgroundBrush}"
                  BorderBrush="{DynamicResource ScrollVerticalOutterBorderBrush}">
            <Border x:Name="border1" Width="Auto" BorderBrush="{DynamicResource ScrollVerticalInnerBorderBrush}"
                    BorderThickness="1" CornerRadius="1" Background="{DynamicResource ScrollVerticalInnerBackgroundBrush}" Padding="2"
                    ClipToBounds="True">
              <StackPanel Width="8" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"
                          Height="Auto" Visibility="Visible">
                <Rectangle Stroke="#66000000" Width="Auto" Margin="0" Height="1" />
                <Rectangle Stroke="#66F8F8F8" Width="Auto" Margin="2,0,0,0" Height="1" />
                <Rectangle Stroke="#66000000" Width="Auto" Margin="0" Height="1" />
                <Rectangle Stroke="#66F8F8F8" Width="Auto" Margin="2,0,0,0" Height="1" />
                <Rectangle Stroke="#66000000" Width="Auto" Margin="0" Height="1" />
                <Rectangle Stroke="#66F8F8F8" Width="Auto" Margin="2,0,0,0" Height="1" />
                <Rectangle Stroke="#66000000" Width="Auto" Margin="0" Height="1" />
                <Rectangle Stroke="#66F8F8F8" Width="Auto" Margin="2,0,0,0" Height="1" />
              </StackPanel>
            </Border>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollVerticalPressedOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollVerticalPressedOutterBorderBrush}" />
              <Setter Property="BorderBrush" TargetName="border1"
                      Value="{DynamicResource ScrollVerticalPressedInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border1"
                      Value="{DynamicResource ScrollVerticalPressedInnerBackgroundBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border"
                      Value="{DynamicResource ScrollVerticalOverOutterBackgroundBrush}" />
              <Setter Property="BorderBrush" TargetName="border"
                      Value="{DynamicResource ScrollVerticalOverOutterBorderBrush}" />
              <Setter Property="BorderBrush" TargetName="border1"
                      Value="{DynamicResource ScrollVerticalOverInnerBorderBrush}" />
              <Setter Property="Background" TargetName="border1"
                      Value="{DynamicResource ScrollVerticalOverInnerBackgroundBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition MaxHeight="18" />
        <RowDefinition Height="0.00001*" />
        <RowDefinition MaxHeight="18" />
      </Grid.RowDefinitions>
      <Border Grid.RowSpan="3" CornerRadius="0" Background="{DynamicResource ScrollVerticalBackgroundBrush}" />
      <RepeatButton x:Name="repeatButton" Grid.Row="0" Style="{StaticResource VerticalScrollBarLineButton}"
                    Height="17" Command="ScrollBar.LineUpCommand" Content="M 0 4 L 8 4 L 4 0 Z" VerticalAlignment="Top" Margin="1,1,1,0"
                    Background="White" />
      <Track Name="PART_Track" Grid.Row="1" IsDirectionReversed="true" ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
            36</sys:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{StaticResource VerticalScrollBarThumb}" Margin="1,0,1,0" RenderTransformOrigin="0.5,0.5" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Row="3" Style="{StaticResource VerticalScrollBarLineButton}"
                    Height="17" Command="ScrollBar.LineDownCommand" Content="M 0 0 L 4 4 L 8 0 Z" Margin="1,0,1,1" Background="White" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition MaxWidth="18" />
        <ColumnDefinition Width="0.00001*" />
        <ColumnDefinition MaxWidth="18" />
      </Grid.ColumnDefinitions>
      <Border Grid.ColumnSpan="3" CornerRadius="0" Margin="0" Background="{DynamicResource ScrollBackgroundBrush}" />
      <RepeatButton x:Name="repeatButton" Grid.Column="0" Style="{StaticResource ScrollBarLineButton}" Width="17"
                    Command="ScrollBar.LineLeftCommand" Content="M 4 0 L 4 8 L 0 4 Z" Margin="1,1,0,1" Background="White" />
      <Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="False" Margin="0,0,0,1"
             ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
            36</sys:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{StaticResource ScrollBarThumb}" Margin="0,0,0,0" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Column="3" Style="{StaticResource ScrollBarLineButton}" Width="17"
                    Command="ScrollBar.LineRightCommand" Content="M 0 0 L 4 4 L 0 8 Z" Margin="0,1,1,1" Background="White" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style TargetType="ScrollBar">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
        <Setter Property="Height" Value="17" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
        <Setter Property="Width" Value="17" />
      </Trigger>
    </Style.Triggers>
  </Style>


</ResourceDictionary>